﻿package mortal.game.view.common.guide.stepOperater
{
    import flash.utils.*;
    import mortal.component.window.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.view.common.guide.data.*;
    import mortal.game.view.common.guide.view.*;
    import mortal.mvc.core.*;

    public class AutoGuideTweenTips extends Object implements IAutoGuideSteper
    {
        private var _pool:Array;
        private var _dic:Dictionary;

        public function AutoGuideTweenTips()
        {
            this._pool = [];
            this._dic = new Dictionary();
            return;
        }// end function

        public function outPool() : AutoGuideTweenTipsItem
        {
            if (this._pool.length == 0)
            {
                return new AutoGuideTweenTipsItem();
            }
            return this._pool.shift();
        }// end function

        public function inPool(param1:AutoGuideTweenTipsItem) : void
        {
            this._pool.push(param1);
            if (param1.data != null)
            {
                delete this._dic[param1.data.mainId + "_" + param1.data.stepId];
            }
            return;
        }// end function

        public function guide(param1:AutoGuideData, param2:Window = null) : void
        {
            if (param1 != null && this._dic.hasOwnProperty(param1.mainId + "_" + param1.stepId))
            {
                return;
            }
            var _loc_3:* = this.outPool();
            _loc_3.guide(param1, this.inPool);
            this._dic[param1.mainId + "_" + param1.stepId] = _loc_3;
            Dispatcher.dispatchEvent(new DataEvent(EventName.AutoGuideStepEnd, param1));
            return;
        }// end function

        public function stop(param1:AutoGuideData = null) : void
        {
            if (param1 == null)
            {
                return;
            }
            var _loc_2:* = this._dic[param1.mainId + "_" + param1.stepId];
            if (_loc_2 != null)
            {
                _loc_2.stop();
            }
            return;
        }// end function

    }
}
